from pprint import pprint
import xmltodict
with open('temp.xml') as fh:
doc = xmltodict.parse(fh.read())
pprint(doc)
# OrderedDict([('mydocument',
# OrderedDict([('@has', 'an attribute'),
# ('and',
# OrderedDict([('many',
# ['elements', 'more elements'])])),
# ('plus',
# OrderedDict([('@a', 'complex'),
# ('#text', 'element as well')]))]))])
doc['mydocument']['@has']
# 'an attribute'
doc['mydocument']['and']['many']
# ['elements', 'more elements']
doc['mydocument']['plus']['@a']
# 'complex'
doc['mydocument']['plus']['#text']
# 'element as well'